Here’s why \r\n instead of only \n (the best answer I could find):
Backward compatibility.
Windows is backward compatible with MS-DOS (aggressively so, even) and MS-DOS used the CR-LF convention because MS-DOS was compatible
with CP/M-80 (somewhat by accident) which used the CR-LF convention because that was how you drove a printer (because printers were originally computer controlled typewriters).
Printers have a separate command to move the paper up one line to a new line, and a separate command for returning the carriage (where
the paper was mounted) back to the left margin.
That's why. And, yes, it is an annoyance, but it is part of the package deal that allowed MS-DOS to win over CP/M, and Windows 95 to
win over all the other GUI's on top of DOS, and Windows XP to take over from Windows 98.
(Note: Modern laser printers still have these commands because they too are backwards compatible with earlier printers - HP in particular
do this well)
Ah, the blessings of backward compatibility.
Jeremy
Group: DynoMotion |
Message: 11640 |
From: Hardy Family |
Date: 6/5/2015 |
Subject: Re: G-code with unix line endings not working |
Ah yes, teletype compatibility.
Getting off-topic here, but it really reflects badly on the software industry: how (I ask rhetorically) could it have been so hard to have the computer read each line of the file to be printed, and translate \n to \r\n. Nobody, and I mean no sane person, wants \n to just roll the platen down to the next line without returning the carriage. CP/M was an excellent OS for the time, but really, guys... :-)
|
|
Group: DynoMotion |
Message: 11650 |
From: Tom Kerekes |
Date: 6/5/2015 |
Subject: Re: G-code with unix line endings not working |
Hi SJH,
Looks like a couple line change to the interpreter to strip off any additional CR or LF at the end of the line should solve this problem.
I have some code to try. Can you attach a file that shows a problem?
Regards TK
Group: DynoMotion |
Message: 11655 |
From: Hardy Family |
Date: 6/6/2015 |
Subject: Re: G-code with unix line endings not working |
Hi Tom,
Here's some sample code. Regards, SJH | | | |